<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});

Route::get('/hello', function () {
    return 'hello word!';
});

//同时配备get和post
Route::match(['get','post'],'test1', function () {
    return '通过match配备get和post';
});

//匹配任意请求方法
Route::get('test2', function () {
    return '通过any()匹配';
});

Route::get('find/{id}', function ($id) {
    return '输入的ID为' . $id;
});

Route::get('find2/{id?}', function ($id=0) {
    return '输入的ID为' . $id;
});
//重新定向
Route::redirect('/hello','/');
//路由别名
Route::get('/hi/wode', function () {
    return '555';
})->name('666');
//路由分组
Route::group(['prefix'=>'admin'], function () {
    Route::get('kabuto', function(){
        return '这里是/admin/kabuto';
    });
    Route::get('faiz', function () {
    return '这里是/admin/faiz';
});
Route::get('den-0', function () {
    return '这里是/admin/den-0';
});
});

Route::get('admin/text1','Admin\TestController@text1');
// Route::get('text/input','TestController@input');
Route::get('text/input/{name}','TestController@input');
Route::get('text1/input/{name}','MyController@input');
Route::get('show/index','MyController@show');
Route::get('test/form','MyController@form');
Route::post('test/tiansfer','MyController@tiansfer')->name('trans');
// 路由
Route::get('text/profile','MyController@profile');
Route::post('text/store','MyController@store')->name('store');

Route::get('user/login','UserController@login');
Route::post('user/check','UserController@check')->name('check');
Route::get('user/index','UserController@index')->middleware('user');
// session

Route::get('test/testSession','TestController@testSession');

Route::group(['middleware'=>'test'], function () {
    Route::get('/', function(){
        return  view('welcome');
    });
});
Auth::routes();

Route::get('/home', 'HomeController@index')->name('home');

Route::get('test/database', 'TestController@database');
Route::get('test/modifyaction', 'TestController@modifyaction');
Route::get('test/members', 'TestController@members');
Route::get('test/lookdata', 'TestController@lookData');

// 文件上传路由
Route::get('txt/avatar', 'ShopController@avatar');
Route::post('txt/up', 'ShopController@up');

Route::get('test/user', 'TestController@user');

Route::get('test/captcha', 'TestController@captcha');
Route::post('test/checkCaptcha', 'TestController@checkCaptcha');

Route::get('test/cache', 'TestController@cache');
Route::get('test/testArr', 'TestController@testArr');
Route::get('test/testStr', 'TestController@testStr');
Route::get('test/testurl', 'TestController@testURL');
Route::get('test/xmldate', 'TestController@xmldate');
Route::get('test/xml', 'TestController@xml');
Route::get('test/jsondate', 'TestController@jsondate');
Route::get('test/json', 'TestController@json');


